<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CrateEpisodeStepCategorySealTime extends AbstractMigration
{
    public function up()
    {

        $this->table('episode_step_category_seal_time', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '单环节集封板时间'])
            ->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('entity_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '集id'])
            ->addColumn('project_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '项目id'])
            ->addColumn('step_category_ids', 'string', ['null' => false, 'default' => '', 'limit' => 128, 'comment' => '大环节'])
            ->addColumn('step_category_code', 'string', ['null' => false, 'default' => '', 'limit' => 128, 'comment' => '环节CODE'])
            ->addColumn('tenant_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '租户id'])
            ->addColumn('seal_time', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '封板时间'])
            ->addColumn('created', 'integer', ['null' => false, 'default' => 0, 'limit' => 11, 'signed' => false, 'comment' => '创建时间'])
            ->addColumn('created_by', 'integer', ['null' => false, 'default' => 0, 'limit' => 11, 'signed' => false, 'comment' => '创建人'])
            ->addColumn('updated', 'integer', ['null' => false, 'default' => 0, 'limit' => 11, 'signed' => false, 'comment' => '更新时间'])
            ->addColumn('updated_by', 'integer', ['null' => false, 'default' => 0, 'limit' => 11, 'signed' => false, 'comment' => '更新人'])
            ->addIndex(['project_id', 'entity_id'], ['type' => 'normal', 'name' => 'idx_project_entity_id'])
            ->save();
    }

    public function down()
    {
        $this->table('episode_step_category_seal_time')->drop()->save();
    }
}
